<?php

namespace App\Http\Resources\shop;


use Illuminate\Http\Resources\Json\ResourceCollection;

class ShopCollection extends ResourceCollection
{
    /**
     * Transform the resource collection into an array.
     *
     * @return \Illuminate\Support\Collection
     */
    public function toArray($request)
    {
        return $this->collection->map(function ($item) {
            return [
                'id' => $item->id,
                'img' => $item->img,
                'name' => $item->name,
                'address' => $item->address,
                'distance' => getDistance($item->distance),
            ];
        });
    }
}
